package com.hzhc.controller.pad;

import com.alibaba.fastjson2.JSONObject;
import com.hzhc.common.BaseController;
import com.hzhc.entity.CntrInfo;
import com.hzhc.enumBean.ResultUtilCodeEnum;
import com.hzhc.service.CntrInfoService;
import com.hzhc.service.DeclareCarService;
import com.hzhc.service.VersionInfoService;
import com.hzhc.utils.ResultUtil;
import com.hzhc.vo.CntrInfoVo;
import com.hzhc.vo.DeclareCarVo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 功不唐捐
 * @since 2024-11-05
 */
@RestController
@RequestMapping("/ipad/declare")
@RequiredArgsConstructor
public class IpadDeclareController extends BaseController {

    private final DeclareCarService declareCarService;
    private final CntrInfoService cntrInfoService;

    /**
     * 获取提箱车辆信息
     */
    @PostMapping("/getTxCarList")
    public ResultUtil<List<DeclareCarVo>> getTxCarList(@RequestBody DeclareCarVo vo) {
        return ResultUtil.build(declareCarService.getTxCarList(vo), ResultUtilCodeEnum.SUCCESS);
    }

    /**
     * pad提箱页面新增在场箱----
     * @param info
     * @return
     */
    @RequestMapping("/addZcCntrMsg")
    public ResultUtil addZcCntrMsg(@RequestBody CntrInfo info) {
        return cntrInfoService.addCntrInfo(info);
    }

    /**
     * 获取落箱车辆信息
     */
    @PostMapping("/getLxCarList")
    public ResultUtil<List<DeclareCarVo>> getLxCarList(@RequestBody DeclareCarVo vo) {
        return ResultUtil.build(declareCarService.getLxCarList(vo), ResultUtilCodeEnum.SUCCESS);
    }
}
